<?php

$id = $_GET['id'];
$name = $_GET['name'];
$price = $_GET['price'];
$num = $_GET['num'];
// 连接数据库
$conn = mysqli_connect('localhost', 'root', 'root', '2005');
// 设置编码
mysqli_query($conn, "set charset 'utf8'");
mysqli_query($conn, "set character set 'utf8'");

//sql 语句
$sql ="update shop set name ='$name',price =$price, num = $num,id=$id";

$res =mysqli_query($conn, $sql);
if($res){
    echo json_encode(array(
        "code"=>200,
        "body"=>array(
            "list"=>"修改产品成功"
        )
    ));
}else{
    echo json_encode(array(
        "code"=>200,
        "body"=>array(
            "list"=>" 网络错误，修改失败"
        )
    ));
}

?>